/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gray.android.field;


import android.content.Context;
import android.view.View;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
import gray.Field;


/**
 *
 * @author martin
 */
public class CheckField extends LinearLayout implements Field<Boolean,View>{
    private final CheckBox _box;
    
    private CheckField(Context context,String name, Character key){
        super(context);
        _box = new CheckBox(context);
        TextView txt = new TextView(context);
        txt.setText(name);
        addView(_box);
        addView(txt);
    }

    public static Field<Boolean,View> factory(Context context, String name, Character key){
        return new CheckField(context,name,key);
    }
    
    @Override
    public Boolean input() {
      return _box.isChecked();
        //return _box.isSelected();
    }

    @Override
    public View container() {
        return this;
    }
    
    @Override
    public Boolean ready() {
        return true;
    }
}
